'use strict';
const db = uniCloud.database();
const dbcmd = db.command;
const {
	result_success,
	result_error
} = require('http-result-modle')
exports.main = async (event, context) => {
	let appid
	let dataId = event.queryStringParameters.id
	if (dataId) {
		let entitlement = await db.collection('wmz-entitlement').doc(dataId).get()
		entitlement = entitlement.data[0]
		appid = entitlement.appid
		if (appid) {
			return result_success({
				appid: "wx257947eb60116e44",
				type: 'wechat'
			})
		} else {
			return result_error('查询数据失败')
		}
	}else{
		return result_error('dataId不存在')
	}

};